﻿using Nemerle;
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;

using System;
using System.Collections.Generic;
using System.Linq;

using NUnit.Framework;
using Nemerle2.Compiler;

namespace Test
{
  /// <summary>
  /// Description of InternalsVisibleToTests.
  /// </summary>
  [TestFixture]
  public class InternalsVisibleToTests : AssemblyTests
  {
  
    [Test]
    public VisibleInternalTypesTest() : void
    {
      def ty = CommonProject.LoadedAssemblies.First().AllTypes.First(t => t.FullName == "TestAssembly.InternalsVisibleToTestClass");
      Assert.True(ty.IsExternallyAccessible(true), "Не вижу internal типа, хотя должен");
    }

    [Test]
    public NotVisibleInternalTypesTest() : void
    {
      def ty = MscoreRefProject.LoadedAssemblies.First().AllTypes.First(t => t.FullName == "System.ReflectionOnlyType");
      Assert.True(ty.Accessibility == Accessibility.Internal, "Тип не интернал. Замените каким нить интернал типом");
      Assert.False(ty.IsExternallyAccessible(false), "Вижу internal типа, хотя НЕ должен") ;
    }
  }
}
